FROM registry.gitee-ai.local/base/iluvatar-corex:3.2.0-bi100
RUN useradd -m -u 1000 user

WORKDIR /home/user/app

RUN apt-get update && apt-get install -y git git-lfs
RUN apt-get install -y ffmpeg libsm6 libxext6
RUN apt-get install -y cmake  libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* && git lfs install

RUN rm ~/.cache/pip -rf

RUN pip install --no-cache-dir datasets "huggingface-hub" "protobuf" "click<8.1" "pydantic==2.7.0"  uvicorn>=0.13.4 spaces  -i https://mirrors.cloud.tencent.com/pypi/simple

COPY requirements.tx[t] /home/user/app

RUN if [ -f ./requirements.txt ]; then \
    pip install --no-cache-dir -r ./requirements.txt -i https://mirrors.cloud.tencent.com/pypi/simple; \
else \
    echo "requirements.txt not found!"; \
fi

COPY --chown=1000 . /home/user/app

RUN chmod -R 777 /home/user/app

ENV PYTHONUNBUFFERED=1

EXPOSE 7860

ENTRYPOINT ["python3", "-m", "tools.webui"]